{include file="common/header.tpl"}
{if $AppUI->id <= 0}
	{include file="index/login.tpl"}  
{else}
	{include file="common/menu.tpl"}
    <div class="rightColumn">
    	<div class="boxContent">
        	<div class="contentItem">
                <div class="contentItems">
                	<div class="headerTitle"><h2><a href="{if isset($smarty.session.ppost.prefer)}{$smarty.session.ppost.prefer}{else}{$refer}{/if}">Quà lưu niệm</a> &raquo; Cập nhật</h2></div>
                    <div class="secData">
                    	<form name="frmEdit" id="frmEdit" method="post" enctype="multipart/form-data" action="{$smarty.const.HOST_BACKEND}product/saveedit">
                        	<input type="hidden" name="pproductid" id="pproductid" value="{$row.productid}" />
                        	 <input type="hidden" name="prefer" id="prefer" value="{if isset($smarty.session.ppost.prefer)}{$smarty.session.ppost.prefer}{else}{$refer}{/if}" />
                        	{if isset($smarty.session.perror)}
                            	<div class="userInput">
                                	<span class="errorMessage">{$smarty.session.perror}</span>
                                </div>
                            {/if}
                        	<div class="userInput">
                                <label for="pcategoryid">Danh mục cấp 1 <span class="symbolRequired">*</span>:</label>
                                <select name="pcategoryid" id="pcategoryid" onchange="javascript:loadSub(this.value,'psubcategoryid');">
                                    <option value="">--Chọn--</option>
                                    {html_options options=$arrCateId selected=$intCateId}
                                </select>
                            </div>
                            <div class="userInput">
                                <label for="psubcategoryid">Danh mục cấp 2 <span class="symbolRequired">*</span>:</label>
                                <select name="psubcategoryid" id="psubcategoryid">
                                    <option value="">--Chọn--</option>
                                    {html_options options=$arrSubCateId selected=$intSubId}
                                </select>
                            </div>
                        	<div class="userInput">
                            	<label for="pname">Tên sản phẩm <span class="symbolRequired">*</span>:</label>
                                <input type="text" class="text" name="pname" id="pname" value="{if isset($smarty.session.ppost.pname)}{$smarty.session.ppost.pname|escape}{else}{$row.name|escape}{/if}" maxlength="255" />
                            </div>
                            <div class="userInput">
                            	<label for="pdescription">Mô tả:</label>
                                <textarea id="pdescription" name="pdescription" rows="0" cols="0">{if isset($smarty.session.ppost.pdescription)}{$smarty.session.ppost.pdescription|escape}{else}{$row.description|escape}{/if}</textarea>
                            </div>
                            <div class="userInput">
                            	<label for="pprice">Giá <span class="symbolRequired">*</span>:</label>
                                <input type="text" class="text" name="pprice" id="pprice" value="{if isset($smarty.session.ppost.pprice)}{$smarty.session.ppost.pprice}{else}{$row.price}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="pprice_sale">Giá bán hệ thống <span class="symbolRequired">*</span>:</label>
                                <input type="text" class="text" name="pprice_sale" id="pprice_sale" value="{if isset($smarty.session.ppost.pprice_sale)}{$smarty.session.ppost.pprice_sale}{else}{$row.price_sale}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="pdiscount">Giảm giá (%):</label>
                                <input type="text" class="text" name="pdiscount" id="pdiscount" value="{if isset($smarty.session.ppost.pdiscount)}{$smarty.session.ppost.pdiscount}{else}{$row.discount}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="pvalue">Số ngày sử dụng <span class="symbolRequired">*</span>:</label>
                                <input type="text" class="text" name="pvalue" id="pvalue" value="{if isset($smarty.session.ppost.pvalue)}{$smarty.session.ppost.pvalue}{else}{$row.value}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="pquantity">Số lượng:</label>
                                <input type="text" class="text" name="pquantity" id="pquantity" value="{if isset($smarty.session.ppost.pquantity)}{$smarty.session.pquantity.pvalue}{else}{$row.quantity}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="pimage">Hình minh họa:</label>
                                <input type="file" class="text" name="pimage" id="pimage"/>
                            </div>
                            {if $row.image != ""}
                            	<div class="userInput">
                                    <label for="pimage">Hình minh họa đã đăng:</label>
                                    {image path=$row.image type=4}
                                </div>
                            {/if}
                            <div class="userInput">
                            	<label for="pimage_exp">Hình hết hạn:</label>
                                <input type="file" class="text" name="pimage_exp" id="pimage_exp"/>
                            </div>
                            {if $row.image_exp != ""}
                            	<div class="userInput">
                                    <label for="pimage">Hình hết hạn đã đăng:</label>
                                    {image path=$row.image_exp type=4}
                                </div>
                            {/if}
                            <div class="userInput">
                            	<label for="plimited">Áp cho thành viên có mối q/h:</label>
                                <select name="plimited" id="plimited">
                                	{if isset($smarty.session.ppost.plimited)}
                                    	{html_options options=$arrLimited selected=$smarty.session.ppost.plimited}
                                    {else}
                                    	{html_options options=$arrLimited selected=$row.limited}
                                    {/if}
                                </select>
                            </div>
                            <div class="userInput">
                            	<label for="ptype">Loại sản phẩm:</label>
                                <select name="ptype" id="ptype">
                                	{if isset($smarty.session.ppost.ptype)}
                                    	{html_options options=$arrType selected=$smarty.session.ppost.ptype}
                                    {else}
                                    	{html_options options=$arrType selected=$row.type}
                                    {/if}
                                </select>
                            </div>
                            <div class="userInput">
                            	<label for="pharvest">Số ngày nhận quà (q/tặng thời gian):</label>
                                <input type="text" class="text" name="pharvest" id="pharvest" value="{if isset($smarty.session.ppost.pharvest)}{$smarty.session.ppost.pharvest}{else}{$row.harvest}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="userInput">
                            	<label for="phot">Hot:</label>
                                <select name="phot" id="phot">
                                	{if isset($smarty.session.ppost.ptype)}
                                    	{html_options options=$arrHot selected=$smarty.session.ppost.phot}
                                    {else}
                                    	{html_options options=$arrHot selected=$row.hot}
                                    {/if}
                                </select>
                            </div>
                            <div class="userInput">
                            	<label for="pdisorder">Trình tự hiển thị:</label>
                                <input type="text" class="text" name="pdisorder" id="pdisorder" value="{if isset($smarty.session.ppost.pdisorder)}{$smarty.session.ppost.pdisorder}{else}{$row.disorder}{/if}" onkeypress="javascript: return isNumberKey(event);"/>
                            </div>
                            <div class="secAction">
                        		<input type="submit" value="Lưu dữ liệu"/>
                               	<input type="button" value="Hủy" onclick="javascript:document.location.href='{if isset($smarty.session.ppost.prefer)}{$smarty.session.ppost.prefer}{else}{$refer}{/if}'"/>
                            </div>
                        </form>
                   	</div>
                </div>
          	</div>
        </div>
    </div>
{/if}
{include file="common/footer.tpl"}
                
